<% layout("/layouts/micro.html",{title:"系统定时任务管理"}){ %>
<div class="childrenBody">
<div class="layui-tab-content">
	<form id="inputForm"  action="${ctx}/sys/schedule/save" method="post" class="layui-form">
		<input type="hidden" name="id" value="${schedule.id!}"/>
		<div class="layui-form-item">
			<label class="layui-form-label">任务名：</label>
			<div class="layui-input-block">
				<input name="name" value="${schedule.name!}" htmlEscape="false" maxlength="64" class="layui-input " />
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">任务组：</label>
			<div class="layui-input-block">
				<select name="tGroup" class="layui-input" >
					<option value="" label="全部"/>
					<#options items="${@DictUtils.getDictList('schedule_task_group')}" value="${schedule.tGroup!}"/>
				</select>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">定时规则：</label>
			<div class="layui-input-block">
				<input name="expression" value="${schedule.expression!}" htmlEscape="false" maxlength="64" class="layui-input " />
                <div style="margin-top: 10px;" class="alert alert-info alert-dismissable">
                    <strong>Cron示例：</strong>前后不要有空格<br>
                    &nbsp;*/5 * * * * ?  每隔5秒执行<br>
                    &nbsp;0 */1 * * * ?  每隔1分钟执行<br>
                    &nbsp;0 0 23 * * ?  每天23点执行<br>
                </div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">启用状态：</label>
			<div class="layui-input-block">
				<#radio name="status" value="${schedule.status!}" items="${@DictUtils.getDictList('yes_no')}" />
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">通知用户：</label>
			<div class="layui-input-block">
				<input name="isInfo" value="${schedule.isInfo!}" htmlEscape="false" maxlength="64" class="layui-input " />
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">任务类：</label>
			<div class="layui-input-block">
				<input name="classname" value="${schedule.classname!}" htmlEscape="false" maxlength="256" class="layui-input " />
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">描述：</label>
			<div class="layui-input-block">
				<input name="description" value="${schedule.description!}" htmlEscape="false" maxlength="255" class="layui-input " />
			</div>
		</div>
		<div class="layui-form-item layui-hide">
	    	<div class="layui-input-block">
	    		<%if(shiro.hasPermission("sys:schedule:edit")){%>
      				<button class="layui-btn" lay-filter="addData" id="addData" lay-submit>保 存</button>
      			<%}%>
		    </div>
	  	</div>
	</form>
	</div>
</div>
	<script>
		layui.use(['form', 'laydate'], function() {
			var form = layui.form, laydate = layui.laydate;
			form.on("submit(addData)",function(data){
				var index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});
				var actionUrl = $("#inputForm").attr("action");
				var formData = $("#inputForm").serialize();//序列化表格内容为字符串  
			    $.ajax({  
			        type:'post',      
			        url:actionUrl,  
			        data:formData,  
			        cache:false,  
			        dataType:'json',  
			        success:function(result){  
		        	 	top.layer.close(index);
			        	top.layer.msg(result.msg);
				 		parent.layui.layer.closeAll();
                        //刷新父页面
                        parent.layui.table.reload("scheduleListTable");
			        }  
			    });
				return false;
		 	})
		});
	</script>
<%}%>